import bpy

UI_CLASSES = []
OERATOR_CLASSES = []
MINI_CLASSES = []

def UI(cls):
    ''' Toggles the Ogre interface panels '''
    if cls not in UI_CLASSES:
        UI_CLASSES.append(cls)
    return cls

def OPERATOR(cls):
    if cls not in OERATOR_CLASSES:
        OERATOR_CLASSES.append(cls)
        bpy.utils.register_class(cls)
    return cls

def OTHER(cls):
    if cls not in UI_CLASSES:
        UI_CLASSES.append(cls)
    return cls

def MINI(cls):
    if cls not in MINI_CLASSES:
        MINI_CLASSES.append(cls)
    return cls

def hide_user_interface():
    for cls in UI_CLASSES:
        bpy.utils.unregister_class(cls)

def show_user_interface():
    for cls in UI_CLASSES:
        try: bpy.utils.register_class(cls)
        except: pass
